package com.niiwoo.civet.trade.dao.mapper;

import com.niiwoo.civet.trade.dao.entity.ProjectPackageInvestOrder;
import com.niiwoo.civet.trade.dto.invest.IntelligenceInvestOrderMaxAndMinDateDTO;
import com.niiwoo.civet.trade.dto.request.ProjectInvestOrderPageRequest;
import com.niiwoo.civet.trade.dto.request.intelligenceInvest.IntelligenceOrderListRequestDTO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.util.List;

@Component
public interface ProjectPackageInvestOrderMapperExt extends ProjectPackageInvestOrderMapper {

    /**
     * 查询智能投包列表总记录数
     */
    Integer getIntelligenceInvestOrderCount(IntelligenceOrderListRequestDTO requestDTO);

    /**
     * 查询智能投包列表
     */
    List<ProjectPackageInvestOrder> getIntelligenceInvestOrderList(IntelligenceOrderListRequestDTO requestDTO);

    List<ProjectPackageInvestOrder> selectTotalNumSuccessInvest(Long packageId);

    BigDecimal selectInvestMoneyTotalNovice(String userId);

    /**
     * 查看投资人信息
     * @param request
     * @return
     */
    List<ProjectPackageInvestOrder> getIntelligenOrderList(@Param("params") ProjectInvestOrderPageRequest request);
    /**
     * 投资中+投资成功
     * @param packageId
     * @return
     */
    Integer countInvested(Long packageId);
    /**
     * 投资中
     * @param packageId
     * @return
     */
    int countInvesting(Long packageId);

    /**
     * 查询我的智能投订单的最大最小日期
     */
    IntelligenceInvestOrderMaxAndMinDateDTO getMyIntelligenceInvestOrderMaxAndMinDate(@Param("userId") String userId, @Param("type") Byte type);

	ProjectPackageInvestOrder selectByPrimaryKeyForUpdate(Long projectPackageInvestOrderId);
	/**
	 * 查询超过十分钟还在投资中的订单
	 * @return
	 */
	List<ProjectPackageInvestOrder> selectOldInvestingOrderByType(Byte status);
		/**
		 * 智能投已经从付款订单资金
		 * @param packageId
		 * @return
		 */
	BigDecimal sumSuccessInvestAmount(Long packageId);
}